package com.cjl.demo.data.structure;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicLong;

/**
 * <p>Copyright: All Rights Reserved</p>
 * <p>Company:    http://www.ronglian.com</p>
 * <p>Description:  大数计算，例如计算n的阶乘，或者6位数乘8位数</p>
 * <p>Author:jlchen/陈金梁</p>
 * <p>Date:  2018/3/30</p>
 */
public class BigDataCount {

    public int[] NxM(int n ,int m){
        char[] mStr = String.valueOf(m).toCharArray();
        char[] nStr = String.valueOf(n).toCharArray();
        int [] mIntArr = new int[mStr.length];
        int [] result = new int[String.valueOf(m).length() +String.valueOf(n).length()];
        //计算乘积
        for(int i = 0; i < mStr.length; i ++){
            mIntArr[i] = Integer.valueOf(mStr[i]) * n;
        }
        //计算进位
        int j = 1;
        for(int i = mIntArr.length-1; i >0; i --){
            int t1 = mIntArr[i] %10 ;
            int t2 = mIntArr[i] /10;
            result[result.length - j] += t1;
            result[result.length -(j+1)] += t2;
            j ++;
        }

    return result;
    }

    public static void main(String[] args) {
//        BigDataCount b = new BigDataCount();
//        int[] t = b.NxM(13,111);
//        for (int i : t){
//            System.out.print("args = [" + i + "]");
//        }
        ConcurrentHashMap concurrentHashMap;
        AtomicLong atomicLong;
        int old = 22222222;
        int newValue =  15 & (old ^ (old >>> 16));
        System.out.println("args = [" + newValue + "]");

    }
}
